/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.myapp.struts;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author Claudia
 */
public class LoginForm extends org.apache.struts.action.ActionForm {
    
   private String userId;
    private String clave;

    public String getClave() {
        return clave;
    }

    public void setClave(String clave) {
        this.clave = clave;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }


   

    /**
     *
     */
    public LoginForm() {
        super();
        // TODO Auto-generated constructor stub
    }



    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getClave() == null || getClave().length() < 1) {
            errors.add("clave", new ActionMessage("error.claveVacio"));
            // TODO: add 'error.name.required' key to your resources
        }
        if (getUserId() == null || getUserId().length() < 1) {
            errors.add("userId", new ActionMessage("error.nombreVacio"));
            // TODO: add 'error.name.required' key to your resources
        }
        return errors;
    }
}
